/*

Author   : chaos

FileName : extend.cpp

Date     : 14/08/17 10:04:42

*/
#include <iostream>
#include <cstring>
using namespace std;

class library_object
{
    protected:
        char name[30];
        long index;
    public:
        void set_data(const char * i_name)
        {
            strcpy(name,i_name);
            index = 1;
        }
        void show_data()
        {
            cout << "name : " << name;
            cout << " index : " << index;
        }
};

class Book:public library_object
{
    private:
        bool on_shelf;
    public:
        void set_data(const char * name)
        {
            library_object::set_data(name);
            on_shelf = true;
        }

        void show_data()
        {
            library_object::show_data();

            if(on_shelf == true)
                cout << " On shelf " << endl;
            else
                cout << " Not on shelf" << endl;
        }
};

int main(int argc ,char *argv[])
{
    Book A_Book;

    A_Book.set_data("The C++ Bible");
    A_Book.show_data();
    return 0;
}
